﻿
@{ Layout = "~/Views/Shared/_SysPage.cshtml"; }
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment HostingEnvironment
@{
    ShowSelfModel currentUser = ViewBag.CurrentUser;
    var currentUserAvatarUrl = Url.Content("~/images/avatar.png");
    if (currentUser != null & !currentUser.ThumbnailPostfix.IsNullOrEmpty())
    {
        var fileName = "thumbnail" + currentUser.ThumbnailPostfix;
        currentUserAvatarUrl = Url.Content("~/File/GetImage/Attachment/UserThumbnail/" + currentUser.ActorId) + "?fileName=" + (fileName) + "&random=" + new Random().Next();
    }
}

@section header{
}

<div class="wrapper wrapper-content">
    <div class="row animated fadeInRight">
        <div class="col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>个人信息</h5>
                    <div class="ibox-tools">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="">
                            <i class="fa fa-edit"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="javascript:showChangeSelfModal()">修改资料</a></li>
                            <li><a href="javascript:showChangePasswordModal()">修改密码</a></li>
                        </ul>
                    </div>
                </div>
                <div class="contact-box">
                    <div class="col-sm-4">
                        <div>
                            <img id="avatar" alt="我的头像" src='@currentUserAvatarUrl' style="margin:0,auto;" class="m-t-xs img-responsive">
                            <div class="m-t-xs font-bold text-center"><span>@ViewBag.Ip</span></div>
                        </div>
                    </div>
                    <div id="userInfo" class="col-sm-8">
                        <p><strong> 账号：<span col="Account"></span></strong></p>
                        <p><i class="fa fa-group"></i> 权限等级：<span col="AuthorizationLevel"></span></p>

                        <p><i class="fa fa-user"></i> 姓名： <span col="Name"></span></p>
                        <p><i class="fa fa-transgender"></i> 性别：<span col="GenderName"></span></p>
                        <p><i class="fa fa-calendar"></i> 生日： <span col="Birthday"></span></p>


                        <p><i class="fa fa-phone"></i> 手机：<span col="Mobile"></span></p>
                        <p><i class="fa fa-envelope-o"></i> 邮件：<span col="Email"></span></p>
                        <p><i class="fa fa-binoculars"></i> QQ：<span col="Qq"></span></p>
                        <p><i class="fa fa-birthday-cake"></i> 微信：<span col="WeChat"></span></p>

                        <p><i class="fa fa-address-book"></i> 组织：<span col="OrganizationPath"></span></p>
                        <p><i class="fa fa-address-book-o"></i> 角色：<span col="RoleNames"></span></p>
                        <p><i class="fa fa-address-card"></i> 权限组：<span col="AuthGroupNames"></span></p>
                        <p><i class="fa fa-address-card-o"></i> 通讯组：<span col="CommGroupNames"></span></p>
                        <p><i class="fa fa-photo"></i> 描述：<span col="Description"></span></p>

                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    var id =@currentUser.ActorId;

    $(function () {
        getForm();
    });

    function getForm() {
        ys.ajax({
                url: '@Url.Content("~/Sys/User/GetSelfShowModelJson")',
                type: "get",
                success: function (rst) {
                    if (rst.Flag == 1) {
                        var result = rst.Data;
                        $("#userInfo").setWebControls(result);
                    }
                    else ys.msgError(rst.Message);
                }
        });
    }


    function showChangeSelfModal() {
        ys.openDialog({
            title: "修改资料",
            content: '@Url.Content("~/Sys/User/ChangeSelfModal")',
            height: '420px',
            callback: function (index, layero) {
                var frame = window[layero.find('iframe')[0]['name']];
                frame.saveForm(index);
            }
        });
        }

    function showChangePasswordModal() {
        ys.openDialog({
            title: "修改密码",
            content: '@Url.Content("~/Sys/User/ChangeSelfPasswordModal")',
            height: '320px',
            callback: function (index, layero) {
                var frame = window[layero.find('iframe')[0]['name']];
                frame.saveForm(index);
            }
        });
    }

</script>
